package com.bootcamp.s2_0922.ds._0929;

import java.util.LinkedList;
import java.util.List;
import java.util.ListIterator;

/**
 * @program: myClassCode
 * @description:
 * @author: Keyu Li
 * @create: 2021-09-29 14:37
 **/

public class Demo1_ListAPI {
    public static void main(String[] args) {
        LinkedList<String> list = new LinkedList<>();
        list.add("ls");
        list.add("ws");
        list.add("zl");
        list.set(2,"89");
        list.add(null);
        list.add("88");
        list.add("md");

        String[] strings = new String[10];
        strings[6] = "66";
        strings[7] = "77";
        strings[8] = "88";
        strings[9] = "99";
        String[] newStrs = list.toArray(strings);
//        for (String string : strings) {
//            System.out.println(string);
//        }
//        System.out.println("-------------");
//        for (String newStr : newStrs) {
//            System.out.println(newStr);
//        }

        ListIterator<String> iterator = list.listIterator();
        iterator.add("00");
//        list.add("11");
        iterator.add("-1-1");
        List<String> subList = list.subList(0, 3);
        System.out.println(subList.getClass());

        System.out.println(list);
    }
}
